<template>
    <div>I am Child</div>

    <div>
        <el-button type="primary" @click="onChange"
            >Change Age in Child</el-button
        >
    </div>
</template>

<script setup lang="ts">
import { inject } from 'vue'

const age = inject<number>('age')
const changeAge = inject<(age: number) => void>('changeAge')

const onChange = () => {
    if (changeAge) {
        changeAge(20)
    }
}
</script>
